package com.dgshanger.sanhxiaofeisc.mvp.model;

import com.dgshanger.sanhxiaofeisc.common.AppApi;
import com.dgshanger.sanhxiaofeisc.entity.HistoryPaidEntity;
import com.dgshanger.sanhxiaofeisc.entity.UserEntity;
import com.dgshanger.sanhxiaofeisc.mvp.contract.PayForContract;
import com.xx.baseutilslibrary.network.rx.RxHelper;
import com.xx.baseutilslibrary.network.rx.RxHttpObserver;

import java.util.List;

/**
 * PayForModel
 * 沉迷学习不能自拔
 * Describe：
 * Created by 雷小星🍀 on 2018/5/7 17:24.
 */

public class PayForModel implements PayForContract.Model {
    @Override
    public void loadUser(String mobile, RxHttpObserver<UserEntity> httpObserver) {
        AppApi.Api()
                .user_by_mobile(mobile)
                .compose(RxHelper.io_main())
                .subscribe(httpObserver);
    }

    @Override
    public void otherPayApply(String otherpay_mobile, String otherpay_vip_id, String otherPayVipQty, String remark, RxHttpObserver<Object> httpObserver) {
        AppApi.Api()
                .otherpay_apply(otherpay_mobile, otherpay_vip_id, otherPayVipQty, remark)
                .compose(RxHelper.io_main())
                .subscribe(httpObserver);
    }

    @Override
    public void shopOtherPayApply(String otherpay_mobile, String otherpay_shop_id, String otherpay_amount, RxHttpObserver<Object> httpObserver) {
        AppApi.Api().shopOtherPay(otherpay_mobile, otherpay_shop_id, otherpay_amount)
                .compose(RxHelper.io_main())
                .subscribe(httpObserver);
    }

    @Override
    public void loadHistory(RxHttpObserver<List<HistoryPaidEntity>> httpObserver) {
        AppApi.Api()
                .otherpay_history()
                .compose(RxHelper.io_main())
                .subscribe(httpObserver);
    }
}
